package com.vtuzx.kingdee.xqc_api.web;

import com.vtuzx.core.VtuzxException;
import com.vtuzx.core.bean.dto.VtuzxFile;
import com.vtuzx.core.bean.dto.VtuzxMap;
import com.vtuzx.core.bean.dto.VtuzxToken;
import com.vtuzx.core.constant.IVtuzxConst;
import com.vtuzx.core.utils.VtuzxUtil;
import com.vtuzx.kingdee.xqc_api.service.IJiKeYunService;
import com.vtuzx.kingdee.xqc_api.service.IXqcTrayService;
import com.vtuzx.web.constant.ApiType;
import com.vtuzx.web.validator.VtuzxValidator;
import com.vtuzx.web.web.VtuzxApi;
import com.vtuzx.web.web.VtuzxControlParam;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.http.ResponseEntity;
import com.vtuzx.kingdee.xqc_core.service.impl.VtuzxBasicServiceImpl;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import static java.util.Calendar.*;

/**
 * 吉克云
 */
@RequestMapping("/${vtuzx.fast.api.path}/${vtuzx.fast.api.version}/jikeyun")
@RestController
public class JiKeYunController {

    private static final Logger log = LoggerFactory.getLogger(JiKeYunController.class);
    @Autowired
    IJiKeYunService jiKeYunService;

    @Autowired
    private VtuzxBasicServiceImpl vtuzxBasicService;

    /**
     * 获取极客云付款单列表
     */
    @PostMapping("/get_payment_list")
    @VtuzxApi
    public Object getPaymentList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        String userName = VtuzxUtil.getString(token, "name");
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getPaymentList(userId,  param,pageIndex,pageSize);
    }

    /**
     * 获取极客云付款单列表(野象公司)
     */
    @PostMapping("/get_payment_list_YX")
    @VtuzxApi
    public Object getPaymentListYX(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        String userName = VtuzxUtil.getString(token, "name");
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getPaymentListYX(userId,  param,pageIndex,pageSize);
    }

    @PostMapping("upload_kingdee_payment")
    @VtuzxApi
    public Object uploadKingdeePayment(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        List<String> billNoList = VtuzxUtil.getObject(param, "billNoList");
        return jiKeYunService.uploadKingdeePayment(_userId,billNoList);
    }

    /**
     * 获取极客云收款单列表
     */
    @PostMapping("/get_collection_list")
    @VtuzxApi
    public Object getCollectionList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getCollectionList(userId,  param,pageIndex,pageSize);
    }

    /**
     * 获取极客云收款单列表(野象)
     */
    @PostMapping("/get_collection_list_YX")
    @VtuzxApi
    public Object getCollectionListYX(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getCollectionListYX(userId,  param,pageIndex,pageSize);
    }

    /**
     * 传收款单到金蝶
     * @param token
     * @param param
     * @return
     * @throws Exception
     */
    @PostMapping("upload_kingdee_collection")
    @VtuzxApi
    public Object uploadKingdeeCollection(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token,"name");
        List<String> billNoList = VtuzxUtil.getObject(param, "billNoList");
        return jiKeYunService.uploadKingdeeCollection(_userId,name,billNoList);
    }

    /**
     * 获取极客云公司间调拨列表
     */
    @PostMapping("/get_innersettorder_list")
    @VtuzxApi
    public Object getInnersettorderList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getBainianAllocationList(userId,  param,pageIndex,pageSize);
    }
    /**
     * 获取极客云公司间调拨列表(已经生成调拨单的)
     */
    @PostMapping("/get_innersettorder_sale_list")
    @VtuzxApi
    public Object getInnersettorderSaleList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getBainianAllocationLogList(userId,  param,pageIndex,pageSize);
    }


    /**
     * 穿金蝶公司间调拨结算单
     * @param token
     * @param param
     * @return
     * @throws Exception
     */
    @PostMapping("upload_kingdee_innersettorder")
    @VtuzxApi
    public Object uploadKingdeeInnersettorder(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String userName = VtuzxUtil.getString(token,"name");
        String orderTime = VtuzxUtil.getString(param,"createTime");
        List<String> billNoList = VtuzxUtil.getObject(param, "billNoList");
        return jiKeYunService.uploadKingdeeInnersettorder(_userId,userName,billNoList,orderTime);
    }

    /**
     * 获取极客云公司间结算列表
     */
    @PostMapping("/get_storage_out_list")
    @VtuzxApi
    public Object getStorageOutList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getStorageOutList(userId,  param,pageIndex,pageSize);
    }

    @PostMapping("upload_kingdee_storage_out")
    @VtuzxApi
    public Object uploadKingdeeStorageOut(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        List<String> billNoList = VtuzxUtil.getObject(param, "billNoList");
        return jiKeYunService.uploadKingdeeStorageOut(_userId,billNoList);
    }

    /**
     * 批量上传金蝶订单
     * @param token
     * @param param
     * @return
     * @throws Exception
     */
    @PostMapping("upload_kingdee_bill")
    @VtuzxApi
    public Object uploadKingdeeBill(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String userName = VtuzxUtil.getString(token, "name");
        jiKeYunService.uploadKingdeeBill(_userId, userName, param);
        return null;
    }

    /**
     * 获取极客云调拨单
     */
    @PostMapping("/get_jky_allocation")
    @VtuzxApi
    public Object getjkyAllocation(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getjkyAllocation(userId,  param,pageIndex,pageSize);
    }

    /**
     * 上传调拨单到金蝶
     * @param token
     * @param param
     * @return
     * @throws Exception
     */
    @PostMapping("/upload_kingdee_allocation")
    @VtuzxApi
    public Object uploadKingdeeAllocation(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        List<String> billNoList = VtuzxUtil.getObject(param, "billNoList");
        return jiKeYunService.uploadKingdeeAllocation(_userId,billNoList);
    }

    /**
     * 获取极客云销售单
     */
    @PostMapping("/get_jikeyun_sale")
    @VtuzxApi
    public Object getJikeyunSale(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getJikeyunSale(userId,  param,pageIndex,pageSize);
    }

    /**
     * 获取极客云销售单(野象公司的)
     */
    @PostMapping("/get_jikeyun_sale_yx")
    @VtuzxApi
    public Object getJikeyunSaleYX(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getJikeyunSaleYX(userId,  param,pageIndex,pageSize);
    }
//    /**
//     * 同步吉克云调拨单
//     */
//    @PostMapping("/sync_allocation")
//    @VtuzxApi
//    public Object syncAllocation(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
//        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
//        String name = VtuzxUtil.getString(token, "name");
//        jiKeYunService.syncAllocation(_userId, name, param);
//        return null;
//    }

    /**
     * 上传极客云销售单到金蝶
     * @param token
     * @param param
     * @return
     * @throws Exception
     */
    @PostMapping("/upload_kingdee_sale")
    @VtuzxApi
    public Object uploadKingdeeSale(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token,"name");
        List<String> billNoList = VtuzxUtil.getObject(param, "billNoList");
        return jiKeYunService.uploadKingdeeSale(_userId,name,billNoList,"2025-03-20");
    }



    /**
     * 导入excle(野象销售单)传金蝶
     */
    @PostMapping("/upload_yexiang_sale_bill")
    @VtuzxApi
    public Object uploadYexiangSaleBill(@VtuzxControlParam VtuzxToken token, @RequestParam Map<String, Object> param, @RequestParam("file") MultipartFile[] files) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token, "name");
        String orderTime = VtuzxUtil.getString(param, "createTime");

        List<VtuzxFile> vFileList = VtuzxUtil.getObject(param, "files");
        jiKeYunService.uploadYexiangSaleBill(_userId, name, vFileList.get(0).file(),orderTime);
        return null;
    }

    /**
     * 导入excle(光年的传网店订单号)传金蝶
     */
    @PostMapping("/upload_guangnian_online")
    @VtuzxApi
    public Object uploadGuangnianOnline(@VtuzxControlParam VtuzxToken token, @RequestParam Map<String, Object> param, @RequestParam("file") MultipartFile[] files) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token, "name");
        List<VtuzxFile> vFileList = VtuzxUtil.getObject(param, "files");
        jiKeYunService.uploadGuangnianOnline(_userId, name, vFileList.get(0).file());
        return null;
    }

    /**
     * 导入excle(野象销售单)传金蝶(包含扣点信息)
     */
    @PostMapping("/upload_yexiang_sale_bill_points")
    @VtuzxApi
    public Object uploadYexiangSaleBillPoints(@VtuzxControlParam VtuzxToken token, @RequestParam Map<String, Object> param, @RequestParam("file") MultipartFile[] files) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token, "name");
        String orderTime = VtuzxUtil.getString(param, "createTime");
        List<VtuzxFile> vFileList = VtuzxUtil.getObject(param, "files");
        jiKeYunService.uploadYexiangSaleBillPoints(_userId, name, vFileList.get(0).file(),orderTime);
        return null;
    }

    /**
     * 导入excle野象公司间调拨单传金蝶(包含公司间调拨和销售)
     */
    @PostMapping("/upload_yexiang_innersetter_bill")
    @VtuzxApi
    public Object uploadYexiangInnersetteBill(@VtuzxControlParam VtuzxToken token, @RequestParam Map<String, Object> param, @RequestParam("file") MultipartFile[] files) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token, "name");
        List<VtuzxFile> vFileList = VtuzxUtil.getObject(param, "files");
        String orderTime = VtuzxUtil.getString(param,"createTime");//手动选择的时间
        jiKeYunService.uploadYexiangInnersetteBill(_userId, name, vFileList.get(0).file(),orderTime);
        return null;
    }


    /**
     * 导入excle野象收款单传金蝶
     */
    @PostMapping("/upload_yexiang_collection_bill")
    @VtuzxApi
    public Object uploadYexiangCollectionBill(@VtuzxControlParam VtuzxToken token, @RequestParam Map<String, Object> param, @RequestParam("file") MultipartFile[] files) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token, "name");
        List<VtuzxFile> vFileList = VtuzxUtil.getObject(param, "files");
        jiKeYunService.uploadYexiangCollectionBill(_userId, name, vFileList.get(0).file());
        return new VtuzxMap("res",true);
    }

    /**
     * 导入excle野象付款单传金蝶
     */
    @PostMapping("/upload_yexiang_payment_bill")
    @VtuzxApi
    public Object uploadYexiangPaymentBill(@VtuzxControlParam VtuzxToken token, @RequestParam Map<String, Object> param, @RequestParam("file") MultipartFile[] files) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token, "name");
        List<VtuzxFile> vFileList = VtuzxUtil.getObject(param, "files");
        jiKeYunService.uploadYexiangPaymentBill(_userId, name, vFileList.get(0).file());
        return null;
    }

    /**
     * 获取价价目表列表
     */
    @PostMapping("/get_price_list")
    @VtuzxApi
    public Object getPriceList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getPriceList(userId,  param,pageIndex,pageSize);
    }

    /**
     * 同步价目表
     */
    @PostMapping("/sync_price_list")
    @VtuzxApi
    public Object syncPriceList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token,"name");

        try {
            jiKeYunService.syncPriceList(userId,name);
        } catch (Exception e){
            throw new VtuzxException(e.getMessage());
        }
        return new VtuzxMap("res",true);
    }

    /**
     * 获取吉客云渠道列表
     */
    @PostMapping("/get_channel_list")
    @VtuzxApi
    public Object getChannelList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getChannelList(userId,  param,pageIndex,pageSize);
    }

    /**
     * 同步渠道信息
     */
    @PostMapping("/sync_channel_list")
    @VtuzxApi
    public Object syncChannelList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token,"name");

        try {
            jiKeYunService.syncChannelList(userId,name);
        } catch (Exception e){
            throw new VtuzxException(e.getMessage());
        }
        return new VtuzxMap("res",true);
    }

    /**
     * 同步仓库信息
     */
    @PostMapping("/sync_warehouse_list")
    @VtuzxApi
    public Object syncWarehouseList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token,"name");

        try {
            jiKeYunService.syncWarehouseList(userId,name);
        } catch (Exception e){
            throw new VtuzxException(e.getMessage());
        }
        return new VtuzxMap("res",true);
    }


    /**
     * 根据出库单重传吉客云入库申请单
     */
    @PostMapping("/sync_storage_out")
    @VtuzxApi
    public Object syncStorageOut(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        String goodsdocNo = VtuzxUtil.getString(param, "goodsdocNo");
        return jiKeYunService.syncStorageOut(goodsdocNo);
    }

    /**
     * 通过调拨单号传金蝶调拨单
     */
    @PostMapping("/upload_jikeyun_allocation")
    @VtuzxApi
    public Object uploadJikeyunAllocation(@VtuzxControlParam VtuzxToken token, @RequestParam Map<String, Object> param, @RequestParam("file") MultipartFile[] files) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String name = VtuzxUtil.getString(token, "name");
        List<VtuzxFile> vFileList = VtuzxUtil.getObject(param, "files");
        String orderTime = VtuzxUtil.getString(param,"createTime");//手动选择的时间
        jiKeYunService.downloadJikeyunAllocation(_userId, name, vFileList.get(0).file(),orderTime);
        return null;
    }

    /**
     * 获取待同步单据
     */
    @PostMapping("/get_sync_list_latest")
    @VtuzxApi
    public Object getSyncListLatest(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getSyncListLatest(userId, param, pageIndex, pageSize);
    }

    /**
     * 获取已同步单据
     */
    @PostMapping("/get_sync_list_history")
    @VtuzxApi
    public Object getSyncListHistory(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getSyncListHistory(userId, param, pageIndex, pageSize);
    }

    /**
     * 获取自采品列表
     */
    @PostMapping("/get_self_item_list")
    @VtuzxApi
    public Object getSelfItemList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getSelfItemList(userId, param, pageIndex, pageSize);
    }

    /**
     * 获取吉客云仓库列表
     */
    @PostMapping("/get_warehouse_list")
    @VtuzxApi
    public Object getWarehouseList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) {
        ObjectId userId = VtuzxUtil.getObject(token, IVtuzxConst.Key__targetId);
        int pageIndex = VtuzxUtil.getInt(param, "pageIndex");
        int pageSize = VtuzxUtil.getInt(param, "pageSize");
        return jiKeYunService.getWarehouseList(userId,  param,pageIndex,pageSize);
    }

    /**
     * 获取生产收货单详细
     */
    @PostMapping("/get_bainian_allocation_detail")
    @VtuzxApi( fields = {
            @VtuzxValidator(key = "billNoList", label = "单号", notNull = true)
    } )
    public Object getBaiNianAllocationList(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        List<String> billNoList = VtuzxUtil.getObject(param, "billNoList");
        return jiKeYunService.getBaiNianAllocationDetail(_userId, billNoList);
    }


    /**
     * 删除百年调拨单
     */
    @PostMapping("/delete_bainian_allocate")
    @VtuzxApi( fields = {
            @VtuzxValidator(key = "billNo", label = "单号", notNull = true)
    } )
    public Object deleteBainianAllocate(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws VtuzxException {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String userName = VtuzxUtil.getString(token,"name");
        String billNo = VtuzxUtil.getString(param, "billNo");
        jiKeYunService.deleteBainianAllocate(_userId,userName, billNo);
        return null;
    }


    /**
     * 吉客云创建调拨单
     */
    @PostMapping("/create_allocation_by_allocation")
    @VtuzxApi
    public Object createAllocationByAllocation(@VtuzxControlParam VtuzxToken token, @RequestBody Map<String, Object> param) throws Exception {
        ObjectId _userId = token.getObject(IVtuzxConst.Key__targetId);
        String userName = VtuzxUtil.getString(token,"name");
        jiKeYunService.createAllocationByAllocation(_userId,userName, param);
        return null;
    }
}